package ai.mspbots.sql.entity;

import cn.hutool.core.util.StrUtil;
import lombok.Data;

@Data
public class GenerateSql {
    // @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    private String createTableSql;
    private String tableComment;
    private String columnCommentDefinitions;
    private String indexDefinitions;


    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        if (StrUtil.isNotEmpty(this.getCreateTableSql())) {
            sb.append(this.getCreateTableSql());
            if (StrUtil.isNotEmpty(this.getTableComment())) {
                sb.append(this.getTableComment());
            }
            if (StrUtil.isNotEmpty(this.getColumnCommentDefinitions())) {
                sb.append(this.getColumnCommentDefinitions());
            }
            if (StrUtil.isNotEmpty(this.getIndexDefinitions())) {
                sb.append(this.getIndexDefinitions());
            }
        }
        return sb.toString();
    }
}
